<template>
	<div>
		<div class="modal" ref="mask" @touchmove.prevent v-if="mold == 1">
			<div class="modalCon">
				<i class="iconfont icon-x_dankuangguanbi1" @click="$emit('closeClick')"></i>
				<div class="modalTit" v-if="title">{{ title }}</div>
				<div class="modalSlot f22">
					<!-- 弹窗自定义区域 -->
					<slot name="modalSlot"></slot>
				</div>
				<div class="modalBtn" v-if="btnTxt">
					<span @click="$emit('cancelClick')" class="cancelBtn f18">{{ btnTxt[0] }}</span>
					<span @click="$emit('configClick')" class="configBtn f18">{{ btnTxt[1] }}</span>
				</div>
			</div>
		</div>
		<div class="toast modal" v-if="mold == 2">
			<div class="toastCon">
				<img class="loadingImg" src="../assets/loading.gif" />
				<div class="toastTit f18">{{ title }}</div>
			</div>
		</div>
		<div class="toast warnToast modal" v-if="mold == 3">
			<div class="toastCon">
				<div class="toastTit f18">{{ title }}</div>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	name: 'popup',
	props: {
		title: {
			type: String
		},
		mold: {
			type: Number,
			default: 1 //1 普通弹窗  2 黑色小提示框
		},
		btnTxt: {
			type: Array
		}
	},
	methods: {}
};
</script>

<style>
.warnToast {
	width: auto !important;
	height: auto !important;
	padding-bottom: 20px;
	padding: 10px 20px;
	border-radius: 5px;
	top: 40% !important;
	left: 50% !important;
}
.warnToast .toastTit{
	margin-top: 0;
}
.modal {
	background: rgba(0, 0, 0, 0.6);
	position: fixed;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10;
}
.modalCon {
	background: #fff;
	width: 519px;
	height: 396px;
	border-radius: 30px;
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	padding: 40px 0;
}
.modalCon .iconfont {
	color: #c4c6cc;
	font-size: 14px;
	position: absolute;
	right: 0;
	top: 0;
	padding: 30px;
}
.modalTit {
	color: #363940;
	font-size: 22px;
	width: 100%;
	text-align: center;
}
.modalSlot {
	width: 340px;
	color: #363940;
	text-align: center;
}
.modalSlot span {
	color: #f45c4b;
	margin: 0 5px;
}
.modalBtn {
	display: flex;
	justify-content: space-between;
	width: 340px;
	margin: 0 auto;
}
.modalBtn span {
	width: 150px;
	height: 42px;
	background: #fff6f5;
	border-radius: 100px;
	text-align: center;
	line-height: 42px;
}
.modalBtn .cancelBtn {
	color: #f45c4b;
	border: 1px solid #f45c4b;
}
.modalBtn .configBtn {
	color: #fff;
	background: linear-gradient(to right, #fc7767, #ec412f);
}
.toast {
	flex-wrap: wrap;
	width: 100%;
	color: #fff;
}
.toastCon {
	text-align: center;
}
.toastTit {
	width: 100%;
	margin-top: 20px;
}
</style>
